cmake_minimum_required(VERSION 3.10)

project(cloud-car-protocol)

add_subdirectory(src)

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cloud-car-protocol.desktop DESTINATION /usr/share/applications)

# 配置生成deb包
set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "test cloud car protocol")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5gui5,libqt5widgets5")
set(CPACK_DEBIAN_PACKAGE_VERSION "1.0.0")

if(${CMAKE_CXX_LIBRARY_ARCHITECTURE} STREQUAL "aarch64-linux-gnu")
    set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "arm64")
elseif(${CMAKE_CXX_LIBRARY_ARCHITECTURE} STREQUAL "arm-linux-gnueabi")
    set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "arm")
elseif(${CMAKE_CXX_LIBRARY_ARCHITECTURE} STREQUAL "arm-linux-gnueabihf")
    set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "arm")
else()
    message("CMAKE_CXX_LIBRARY_ARCHITECTURE:${CMAKE_CXX_LIBRARY_ARCHITECTURE}")
endif()

set(CPACK_PACKAGE_FILE_NAME "cloud-car-protocol-${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
include(CPack)